package com.example.a040728.myapplication.strict.base;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import butterknife.ButterKnife;

/**
 * BaseActivity
 */
public abstract class BaseActivity extends AppCompatActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        if(initBundle(getIntent().getExtras())) { //根据外部数据进行初始化
            setContentView(getContentView());

            initWindow();

            ButterKnife.bind(this);

            initWidget();

            initData();

        } else {
            finish();
        }

    }

    protected abstract int getContentView();

    protected void initWindow() {

    }

    protected void initWidget() {

    }

    protected void initData() {

    }

    protected boolean initBundle(Bundle bundle) {
        return true;
    }
}
